package com.basaji.manager.impl;

import java.util.List;

import com.basaji.dao.IBaseDao;
import com.basaji.domain.pojo.BaseObject;
import com.basaji.manager.IBaseManager;

public class BaseManager implements IBaseManager {

	private IBaseDao baseDao;

	public void delete(BaseObject baseObject) {
		try{
			baseDao.delete(baseObject);
		}catch(Exception e){
			
		}
		
		
	}

	public BaseObject get(Class<? extends BaseObject> clazz, Object id) {
		try{
			return baseDao.get(clazz, id);
		}catch(Exception e){
			return null;
		}
	}

	public void saveOrUpdate(BaseObject baseObject) {
		try{
			baseDao.saveOrUpdate(baseObject);
		}catch(Exception e){
			
		}
		
	}

	public IBaseDao getBaseDao() {
		return baseDao;
	}

	public void setBaseDao(IBaseDao baseDao) {
		this.baseDao = baseDao;
	}

	
	public void save(BaseObject t) {
		try {
			baseDao.save(t);
		} catch (Exception e) {

			e.printStackTrace();
		}
		
	}


	public void update(BaseObject t) {
		try {
			baseDao.update(t);
		} catch (Exception e) {

			e.printStackTrace();
		}
		
	}

	@Override
	public <T> List<T> getList(String hql, Object[] values, int start, int size) {

		try {
			return baseDao.getList(hql, values, start, size);
		} catch (Exception e) {
			
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public int getCount(String hql, Object[] values) {

		try {
			return baseDao.getCount(hql, values);
		} catch (Exception e) {
	
			e.printStackTrace();
		}
		return 0;
	}
	
}
